package xinxin.com.PrototypePattern.Resume;

import xinxin.com.PrototypePattern.Resume.WorkExperience.WorkExperience;

public class Resume implements Cloneable {
    private String name;
    private String sex;
    private String age;
    private WorkExperience work;

    public Resume(String name) {
        this.name = name;
        this.work = new WorkExperience();
    }

    public void SetPersonalInfo(String sex, String age) {
        this.sex = sex;
        this.age = age;
    }

    public void SetWorkExperience(WorkExperience work) {
        this.work = (WorkExperience) work.Clone();
    }

    public void SetWorkExperience(String workDate, String company) {
        this.work.setWorkDate(workDate);
        this.work.setCompany(company);
    }

    public void Display() {
        System.out.println(name + " " + sex + " " + age);
        System.out.println("工作经历：" + work.getWorkDate() + " " + work.getCompany());
    }

    public Resume Clone() {
        // 浅层复制
        Resume resume = null;
        try {
            resume = (Resume) super.clone();
            resume.SetWorkExperience(this.work);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return resume;
    }
}
